<?php
class Servicemanager_Model_Editcurrentservice implements Servicemanager_Model_Mainable{
    
    private $core_controller_notnull;
    private $core_controller_csrftoken;
    
    private $servicemanager_data_updateservicesettings;
    private $servicemanager_data_updateservicemetavalues;
    private $servicemanager_data_updateservicecontentvalues;
    
    private $update_service_settings_result;
    private $update_service_meta_values_result;
    private $update_service_content_values_result;
    
    private $excepted_result = 1;
    
    public function main(array $variables = null) {
        $this->core_controller_notnull = new Core_Controller_Notnull;
        $this->core_controller_notnull->main($variables);
        $this->core_controller_csrftoken = new Core_Controller_Csrftoken;
        $this->core_controller_csrftoken->main($variables);
        
        $this->servicemanager_data_updateservicesettings = new Servicemanager_Data_Updateservicesettings;
        $this->servicemanager_data_updateservicemetavalues = new Servicemanager_Data_Updateservicemetavalues;
        $this->servicemanager_data_updateservicecontentvalues = new Servicemanager_Data_Updateservicecontentvalues;
        
        $this->update_service_settings_result = $this->servicemanager_data_updateservicesettings->main($variables);
        $this->update_service_meta_values_result = $this->servicemanager_data_updateservicemetavalues->main($variables);
        $this->update_service_content_values_result = $this->servicemanager_data_updateservicecontentvalues->main($variables);
        
        if(
                ($this->update_service_settings_result == $this->excepted_result) &&
                ($this->update_service_meta_values_result == $this->excepted_result) &&
                ($this->update_service_content_values_result == $this->excepted_result)
                ){
           header("Location: ".SITE_ROOT."zarzadzaj-uslugami.html"); 
        }
        else {
           header("Location: ".SITE_ROOT."zarzadzaj-uslugami.html"); 
        }
    }

}
